home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
util
/
cdity
/
ModeProSrc.lha
/
Daemon
/
ptObtainPens.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-10-01
|
2KB
|
102 lines
#include "MP.h"
#include "PatchData.h"
extern BOOL V39;
void mpObtainPens(struct PatchData *pd)
{
UBYTE *str,state=0,done=FALSE;
WORD num=0,num1=0,num2;
struct ColorMap *cm;
if(pd->DNode->Flags & SHAREPENS &&
pd->DNode->LockedPens &&
V39)
{
cm=pd->OpenNode->Screen->ViewPort.ColorMap;
str=pd->DNode->LockedPens;
while(!done)
{
if(!*str) done=TRUE;
if(*str>='0' && *str<='9')
{
if(state==0)
state=1;
num=0;
while(*str>='0' && *str<='9')
{
num*=10;
num+=*str - '0';
str++;
}
switch(state)
{
case 1:
#ifdef ADD_DEBUG_CODE
if(MPSem->Debug)
{
KP(" obtaining pen %ld\n",num);
}
#endif
if(num<256) // 4.50 - bounds check
{
if(!pd->OpenNode->ObtainedPens[num])
{
if(-1!=ObtainPen(cm,num,0,0,0, PEN_EXCLUSIVE | PEN_NO_SETCOLOR))
pd->OpenNode->ObtainedPens[num]=1;
}
}
break;
case 2:
if(num1>num)// 4.50
{
LONG dummy;
dummy=num1;
num1=num;
num=dummy;
}
for(num2=num1+1;num2<=num;num2++)
{
#ifdef ADD_DEBUG_CODE
if(MPSem->Debug)
{
KP(" obtaining pen %ld\n",num2);
}
#endif
if(num2<256)// 4.50
{
if(!pd->OpenNode->ObtainedPens[num2])
{
if(-1!=ObtainPen(cm,num2,0,0,0, PEN_EXCLUSIVE | PEN_NO_SETCOLOR))
pd->OpenNode->ObtainedPens[num2]=1;
}
}
}
break;
}
state=0;
}
if(*str==' ')
for(;*str==' ';str++);
else
if(*str=='-')
{
num1=num;
state=2;
str++;
}
else
str++;
}
}
}